package com.jy.service.impl;

import com.jy.bean.ShoppingTrolley;
import com.jy.dao.ShoppingTrolleyDao;
import com.jy.service.ShoppingTrolleyService;

import java.util.List;

public class ShoppingTrolleySericelmpl implements ShoppingTrolleyService {
    private ShoppingTrolleyDao shoppingTrolleyDao;
    @Override
    public boolean register(ShoppingTrolley st) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.register(st);
    }

    @Override
    public Integer selectByName(String name) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.selectByName(name);
    }

    @Override
    public Integer selectQuantity(Integer user_id, Integer consignee_id) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.selectQuantity(user_id,consignee_id);
    }

    @Override
    public Boolean updateQuantity(ShoppingTrolley st) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.updateQuantity(st);
    }

    @Override
    public List<ShoppingTrolley> selectByUsername(String name) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.selectByUsername(name);
    }

    @Override
    public Boolean deleteByName(String name) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.deleteByName(name);
    }

    @Override
    public Boolean deleteById(Integer id) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.deleteById(id);
    }

    @Override
    public Boolean updateByproductNameQuantity(String productName, String amount) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.updateByproductNameQuantity(productName, amount);
    }

    @Override
    public List<ShoppingTrolley> selectByUserId(Integer id) {
        shoppingTrolleyDao = new ShoppingTrolleyDao();
        return shoppingTrolleyDao.selectByUserId(id);
    }
}
